#!/bin/bash

for patch in patches/*.patch; do
  OUTPUT=$(patch -d LibreELEC.tv/ --dry-run -p1 < "$patch")
  if [[ $? -ne 0 ]]; then
    echo "[!!] $patch"
    echo "     --------------------------------------------------------------"
    while IFS= read -r line; do
      echo "     $line"
    done <<< $(patch -d LibreELEC.tv/ --dry-run -p1 --verbose < "$patch")
  else
    echo "[OK] $patch"
  fi
done
